package com.bdtop.dbl.ui.view;

import android.app.Dialog;
import android.content.Context;
import android.view.LayoutInflater;
import android.view.View;
import android.view.View.OnClickListener;
import android.widget.TextView;

import com.bdtop.dbl.R;

public class SelectDialog {
    
    private Dialog mDialog;
    
    public SelectDialog(final Context context,final DialogInterfaceListener listener) {
        mDialog = new Dialog(context,R.style.Theme_Light_NoTitle_Dialog);
        View content = LayoutInflater.from(context).inflate(
                R.layout.dialog_select_1_2, null);
        mDialog.setContentView(content);
        ((TextView) mDialog.findViewById(R.id.tx_camera)).setOnClickListener(new OnClickListener() {

            @Override
            public void onClick(View view) {
                mDialog.dismiss();
                listener.photoListener(mDialog);
            }
        });

        ((TextView) mDialog.findViewById(R.id.tx_album)).setOnClickListener(new OnClickListener() {

            @Override
            public void onClick(View view) {
                mDialog.dismiss();
                listener.cameraListener(mDialog);
            }
        });
    }
    
    public void show() {

        mDialog.setCanceledOnTouchOutside(true);
        mDialog.setCancelable(true);
        mDialog.show();
    }
    
    public interface DialogInterfaceListener {
        void photoListener(Dialog mDialog);

        void cameraListener(Dialog mDialog);
    }

}
